home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7433 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.mira.net.au!news
  2. From: davidw@werple.net.au (David White)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Is there a standard for * and & placement style?
  5. Date: 23 Feb 1996 20:28:08 +1100
  6. Organization: Werple Internet, Melbourne
  7. Message-ID: <4gk1b8$mtm@werple.net.au>
  8. References: <3128BD31.4AF8@wildfire.com> <marnoldDn27q9.Is0@netcom.com> <4gckd5$bc7@clarknet.clark.net> <marnoldDn63vB.H6n@netcom.com>
  9. NNTP-Posting-Host: werple.mira.net.au
  10.  
  11. marnold@netcom.com (Matt Arnold) writes:
  12.  
  13. >gusty@clark.net (Harlan Messinger) writes:
  14.  
  15. >>I think the syntax is dumb in the first place. One declaration statement 
  16. >>should declare variables of one type. I think
  17.  
  18. >>    char* a, b, c;
  19.  
  20. >>should declare three (char*) variables. If someone also wants a char 
  21. >>variable d, then that should be on two lines:
  22.  
  23. >That would be better, but I still subscribe to the "one concept per
  24. >line" theory of programming and would never declare three variables on
  25. >a single line.  
  26.  
  27. The concept used in declarations is that a declaration mimics an
  28. expression, e.g., given char *p, if you see *p then it evaluates to a
  29. char. The above form is therefore a special case because it can't always
  30. be used. In the case of, for example, char (*p)[10], you can't apply it. 
  31. I can see that in the trivial special cases, like char* foo(), it seems
  32. more sensible to some people (foo() returns a char*), but it is an oddity
  33. in terms of the general rule. 
  34.  
  35. David White
  36. davidw@werple.mira.net.au
  37.